#!/usr/bin/env python
# -*- coding:utf8 -*-

import datetime
import inspect,re, sys

def main():
    #set the timestamp
    ts = 'Sun Apr 24 19:44:39 2011'
    print "the timestamp is <<<%s>>>" % (ts)
    src_file = open(sys.argv[0], 'r')
    src = src_file.read()
    src_file.close()
    #change it to the current
    now = datetime.datetime.ctime(datetime.datetime.now())
    match = re.search("ts = '(.*)'", src)
    if match:
        src = src[:match.start(1)] + now + src[match.end(1):]
    #write it back
    f = open(sys.argv[0], 'w')
    f.write(src)
    f.close()

def __file__():
    pass

if __name__ == "__main__":
    main()
